<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

</body>
</html>
<script>
  /* 韩金奇 */
  function num(arr) {
    for (let i = 1; i < arr.length; i++) {
      let preIndex = i - 1;
      let target = arr[i]; // 向有序数组插入的数
      while (preIndex >= 0 && arr[preIndex] > target) {
        arr[preIndex + 1] = arr[preIndex]; // 最大的网前移
        preIndex -= 1
      }
      arr[preIndex + 1] = target;
    }
    return arr
  }

  let a = [34, 78, 90, 3, 100];
  console.log(num(a))
</script>
